﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using PMSA.Framework.Database;

/// <summary>
/// Summary description for CGroupNewsFacade
/// </summary>
public class CGroupNewsFacade
{
    private GroupNewsDAL db = new GroupNewsDAL();
    public IList<GroupNews> List()
    {
        IList<GroupNews> list = null;
        DataSet ds = new DataSet();
        ds = db.List();
        if (ds != null && ds.Tables.Count > 0)
        {
            list = CDb.MapList<GroupNews>(ds.Tables[0]);
        }

        return list;
    }
    public GroupNews Detail(int GroupNewsId)
    {
        DataSet ds = new DataSet();
        ds = db.Detail(GroupNewsId);
        GroupNews obj = CDb.Map<GroupNews>(ds.Tables[0]);
        return obj;
    }
    public GroupNews Update(int GroupNewsid, string name, int Status)
    {
        DataSet ds = new DataSet();
        ds = db.Update(GroupNewsid, name, Status);
        GroupNews obj = CDb.Map<GroupNews>(ds.Tables[0]);
        return obj;
    }
    public GroupNews Insert(string GroupNewsName, int Status)
    {
        DataSet ds = new DataSet();
        ds = db.Insert(GroupNewsName, Status);
        GroupNews obj = CDb.Map<GroupNews>(ds.Tables[0]);
        return obj;
    }
    public GroupNews UpdateStatusActive(int GroupNewsid, int Status)
    {
        DataSet ds = new DataSet();
        ds = db.UpdateStatusActive(GroupNewsid, Status);
        GroupNews obj = CDb.Map<GroupNews>(ds.Tables[0]);
        return obj;
    }
}